﻿using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using XZDFramework.json;

namespace SourcesUnPacker
{
    public class SkillReader
    {
        public const string PATH = "F:\\IosIPA\\ReadMoon";

        public static void test()
        {
            var json = File.ReadAllText(PATH + "\\data.json");
            //json序列化
            JObject jsonObject = JObject.Parse(json);
            var skillDataList = new List<SkillData>();
            JArray skillArray = (JArray)jsonObject["4c3da31"];
            
            // 从索引 1 开始迭代，跳过第一个列表
            for (int i = 1; i < skillArray.Count; i++)
            {
                JArray skillItem = (JArray)skillArray[i];
                var skillData = new SkillData(skillItem);
                skillDataList.Add(skillData);
            }

            foreach (var VARIABLE in skillDataList)
            {
                var skillDataJson= JsonHelper.ToString(VARIABLE);
                if (VARIABLE._Name.Equals("召回"))
                {
                    Console.WriteLine(skillDataJson);
                }
                
            }
            //将数据写到一个json文件里
            File.WriteAllText(PATH + "\\skill.json", JsonHelper.ToString(skillDataList));
        }
    }
}